﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace helloworld2.MODEL
{
    class NodeContainer
    {

        private static NodeContainer instance = null;

        private NodeContainer()
        {
        }

        public static NodeContainer Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new NodeContainer();
                }
                return instance;
            }
        }

        List<Node> nodes = new List<Node>();

        public void addNode(Node newNode)
        {
            nodes.Add(newNode);
        }

        public List<Node> getNodes()
        {
            List<Node> node = new List<Node>();
            foreach (Node n in nodes)
            {
                node.Add(n);

            }
            return node;
        }

        public Node getNodeByID(int id)
        {
            Node n = new Node();
            for (int i = 0; i < nodes.Count; i++)
            {
                if (nodes[i].id.Equals(id))
                {
                    n = nodes[i];
                }
            }
            return n;
        }
    
    
    
    
    }
}
